package com.linktrip.devicemanager.cmpp;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.linktrip.devicemanager.sms.SMSConfig;

@Component
public class ConnectScheduled {

	@Scheduled(cron = "0 1 0 * * ?")
	public void beat() {
		int count = 0;
		boolean result = CMPPService.activityTestISMG();
		while (!result) {
			count++;
			result = CMPPService.activityTestISMG();
			if (count >= (SMSConfig.getConnectCount() - 1)) {// 如果再次链路检查次数超过两次则终止连接
				break;
			}
		}
	}
}
